# Mission 10 AccelTest # Objective 10 from botcore import * from time import sleep_ms SPEED = 20 # -- Safety feature -- while True: if buttons.was_pressed(0): break # -- Main program -- motors.enable(True) while True: x, y, z = accel.read() if y < 7000 and abs(x) < 4000: rot_spd = SPEED * (x / 4000) elif x < 0: rot_spd = -SPEED else: rot_spd = SPEED # Rotate motors.run(LEFT, rot_spd) motors.run(RIGHT, -rot_spd)